<!DOCTYPE html>


<head xmlns:>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <title>产品列表页</title>
    <link rel="icon" href="assets/img/favicon.ico">
    <link rel="stylesheet" type="text/css" href="css/webbase.css"/>
    <link rel="stylesheet" type="text/css" href="css/pages-list.css"/>
    <link rel="stylesheet" type="text/css"
          href="css/widget-cartPanelView.css"/>
    <script src="./plugins/vue/vue.js" type="application/javascript"></script>
    <script src="./plugins/vue/axios-0.18.0.js" type="application/javascript"></script>
	<link type="text/css" rel="stylesheet" href="./plugins/elementui/index.css">
	<script type="text/javascript" src="./plugins/elementui/index.js"></script>

</head>
<body>
<!-- 头部栏位 -->
<!--页面顶部-->
<div id="app">
    <div id="nav-bottom">
        <!--头部-->
        <div class="header">
            <div class="py-container">
                <div class="yui3-g Logo">
                    <div class="yui3-u Left logoArea">
                        <a class="logo-bd" title="爱思乐" href="JD-index.html"
                           target="_blank"></a>
                    </div>
                    <div class="yui3-u Center searchArea">
                        <div class="search">
                            <form action="" class="sui-form form-inline">
                                <!--searchAutoComplete-->
                                <div class="input-append">
                                    <input type="text" id="autocomplete" type="text" v-model="keyword"
                                           class="input-error input-xxlarge"/>
                                    <button class="sui-btn btn-xlarge btn-danger" @click="findByPage" type="button">搜索
                                    </button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--list-content-->
    <div class="main">
        <div class="py-container">
            <!--selector-->
            <div class="clearfix selector">
                <div class="type-wrap">
                    <div class="fl key">商品分类</div>
                    <div class="fl value">
                        <a href="#">手机</a> <a href="#">电视</a>
                    </div>
                    <div class="fl ext"></div>
                </div>
                <div class="type-wrap logo">
                    <div class="fl key brand">品牌</div>
                    <div class="value logos">
                        <ul class="logo-list">
                            <li><img src="img/assets/img/phone/phone01.png"/></li>
                            <li><img src="img/assets/img/phone/phone02.png"/></li>
                            <li><img src="img/assets/img/phone/phone03.png"/></li>
                            <li><img src="img/assets/img/phone/phone04.png"/></li>
                            <li><img src="img/assets/img/phone/phone05.png"/></li>
                            <li><img src="img/assets/img/phone/phone06.png"/></li>
                            <li><img src="img/assets/img/phone/phone07.png"/></li>
                            <li><img src="img/assets/img/phone/phone08.png"/></li>
                            <li><img src="img/assets/img/phone/phone09.png"/></li>
                            <li><img src="img/assets/img/phone/phone10.png"/></li>
                            <li><img src="img/assets/img/phone/phone11.png"/></li>
                            <li><img src="img/assets/img/phone/phone12.png"/></li>
                            <li><img src="img/assets/img/phone/phone13.png"/></li>
                            <li><img src="img/assets/img/phone/phone14.png"/></li>
                            <li><img src="img/assets/img/phone/phone05.png"/></li>
                            <li><img src="img/assets/img/phone/phone06.png"/></li>
                            <li><img src="img/assets/img/phone/phone07.png"/></li>
                            <li><img src="img/assets/img/phone/phone02.png"/></li>
                        </ul>
                    </div>
                    <div class="ext">
                        <a href="javascript:void(0);" class="sui-btn">多选</a> <a
                            href="javascript:void(0);">更多</a>
                    </div>
                </div>
                <div class="type-wrap">
                    <div class="fl key">网络制式</div>
                    <div class="fl value">
                        <ul class="type-list">
                            <li><a>GSM（移动/联通2G）</a></li>
                            <li><a>电信2G</a></li>
                            <li><a>电信3G</a></li>
                            <li><a>移动3G</a></li>
                            <li><a>联通3G</a></li>
                            <li><a>联通4G</a></li>
                            <li><a>电信3G</a></li>
                            <li><a>移动3G</a></li>
                            <li><a>联通3G</a></li>
                            <li><a>联通4G</a></li>
                        </ul>
                    </div>
                    <div class="fl ext"></div>
                </div>
                <div class="type-wrap">
                    <div class="fl key">显示屏尺寸</div>
                    <div class="fl value">
                        <ul class="type-list">
                            <li><a>4.0-4.9英寸</a></li>
                            <li><a>4.0-4.9英寸</a></li>
                        </ul>
                    </div>
                    <div class="fl ext"></div>
                </div>
                <div class="type-wrap">
                    <div class="fl key">摄像头像素</div>
                    <div class="fl value">
                        <ul class="type-list">
                            <li><a>1200万以上</a></li>
                            <li><a>800-1199万</a></li>
                            <li><a>1200-1599万</a></li>
                            <li><a>1600万以上</a></li>
                            <li><a>无摄像头</a></li>
                        </ul>
                    </div>
                    <div class="fl ext"></div>
                </div>
                <div class="type-wrap">
                    <div class="fl key">价格</div>
                    <div class="fl value">
                        <ul class="type-list">
                            <li v-for="priceItem in priceRange" @click="choosePriceRange(priceItem)">
								<a>{{priceItem.priceRangeItem}}</a>
							</li>
                        </ul>
                    </div>
                    <div class="fl ext"></div>
                </div>
                <div class="type-wrap">
                    <div class="fl key">更多筛选项</div>
                    <div class="fl value">
                        <ul class="type-list">
                            <li><a>特点</a></li>
                            <li><a>系统</a></li>
                            <li><a>手机内存 </a></li>
                            <li><a>单卡双卡</a></li>
                            <li><a>其他</a></li>
                        </ul>
                    </div>
                    <div class="fl ext"></div>
                </div>
            </div>
            <!--details-->
            <div class="details">
                <div class="sui-navbar">
                    <div class="navbar-inner filter">
                        <ul class="sui-nav">
                            <li class="active"><a href="#">综合</a></li>
                            <li><a href="#">销量</a></li>
                            <li><a href="#">新品</a></li>
                            <li><a href="#">评价</a></li>
                            <li @click="changeSort">价格</li>
                        </ul>
                    </div>
                </div>
                <!-- 商品列表 -->
                <div class="goods-list">
                    <ul class="yui3-g">
                        <li class="yui3-u-1-5" v-for="item in results">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <a href="item.html" target="_blank"><img
                                            :src="item.image"/></a>
                                </div>
                                <div class="price">
                                    <strong> <em>¥</em> <i>{{item.price}}</i>
                                    </strong>
                                </div>
                                <div class="attr" v-html="item.name">
                                    <em>{{item.name}}</em>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="fr page">
                    <div class="sui-pagination pagination-large">

                    </div>
                </div>
                <template>
                    <el-pagination
                            class="pagiantion"
                            @current-change="handleCurrentChange"
                            :current-page="pagination.currentPage"
                            :page-size="pagination.pageSize"
                            layout="total, prev, pager, next, jumper"
                            :total="pagination.total"
                    >
                    </el-pagination>
                </template>


            </div>
            <!--hotsale-->
            <div class="clearfix hot-sale">
                <h4 class="title">热卖商品</h4>
                <div class="hot-list">
                    <ul class="yui3-g">
                        <li class="yui3-u-1-4">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="img/like_01.png"/>
                                </div>
                                <div class="attr">
                                    <em>Apple苹果iPhone 6s (A1699)</em>
                                </div>
                                <div class="price">
                                    <strong> <em>¥</em> <i>4088.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-4">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="img/like_03.png"/>
                                </div>
                                <div class="attr">
                                    <em>金属A面，360°翻转，APP下单省300！</em>
                                </div>
                                <div class="price">
                                    <strong> <em>¥</em> <i>4088.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-4">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="img/like_04.png"/>
                                </div>
                                <div class="attr">
                                    <em>256SSD商务大咖，完爆职场，APP下单立减200</em>
                                </div>
                                <div class="price">
                                    <strong> <em>¥</em> <i>4068.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有20人评价</i>
                                </div>
                            </div>
                        </li>
                        <li class="yui3-u-1-4">
                            <div class="list-wrap">
                                <div class="p-img">
                                    <img src="img/like_02.png"/>
                                </div>
                                <div class="attr">
                                    <em>Apple苹果iPhone 6s (A1699)</em>
                                </div>
                                <div class="price">
                                    <strong> <em>¥</em> <i>4088.00</i>
                                    </strong>
                                </div>
                                <div class="commit">
                                    <i class="command">已有700人评价</i>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            keyword: '',
            price: '',
            results: [],
			minPrice: undefined,
			maxPrice: -1,
            sortByPrice:false,
            descFlag:false,
            pagination: {
                //分页相关属性
                currentPage: 1,
                pageSize: 18,
                total: 0,
                // queryString: null,
            },
			priceRange:[
				{
					priceRangeItem:"0-500",
					minPrice:0,
					maxPrice:500
				},
				{
					priceRangeItem:"500-1000",
					minPrice:500,
					maxPrice:1000
				},
				{
					priceRangeItem:"1000-1500",
					minPrice:1000,
					maxPrice:1500
				},
				{
					priceRangeItem:"1500-2000",
					minPrice:1500,
					maxPrice:2000
				},
				{
					priceRangeItem:"2000-3000",
					minPrice:2000,
					maxPrice:3000
				},
				{
					priceRangeItem:"3000以上",
					minPrice:3000,
					maxPrice:-1
				}
			]
        },
        methods: {
            /*searchKey() {
                let keyword = this.keyword;
                if (keyword) {
                    axios.get('/good/search?keyword=' + this.keyword).then((result) => {
                        this.results = result.data.data;
                        this.total = result.data.total;
                        console.log(result.data.data)

                    })
                }
            },*/
			findByPage() {
            	axios.post("/good/search",{
            		"keyword":this.keyword,
					"minPrice":this.minPrice,
					"maxPrice":this.maxPrice,
                    "currentPage":this.pagination.currentPage,
                    "pageSize":this.pagination.pageSize,
                    "sortByPrice":this.sortByPrice,
                    "descFlag":this.descFlag,
                    "sortByPrice":this.sortByPrice
				}).then(res=>{
                    this.results = res.data.data;
                    this.pagination.total = res.data.total;
                    console.log(res.data.total)
				})
			},
            //切换页码
            handleCurrentChange(currentPage) {
                this.pagination.currentPage = currentPage;
                this.findByPage();
            },
            choosePriceRange(price) {
                this.currentPage =1;
                this.maxPrice = price.maxPrice;
                this.minPrice = price.minPrice;
                this.findByPage();
            },
            changeSort() {
                this.currentPage = 1;
                this.sortByPrice = true;
                if (this.descFlag === false) {
                    this.descFlag = true;
                    this.findByPage();

                } else {
                    this.descFlag = false;
                    this.findByPage();

                }
            },
        }
    });
</script>

</body>

</html>